<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>index.html</title>

		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="this is my page">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" type="text/css"
			href="css/jquery.mobile-1.4.5.min.css">
		<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="js/jquery.mobile-1.4.5.js"></script>
	</head>

	<body>
	    <script type="text/javascript">
	    $(function(){
	           //添加日报-添加 
	           $("#addMsgId").html("");
		       //添加日报
               $("#addbutId").bind('click',function(){
		             var item = $("#itemId").val();
		             var time = $("#timeId").val();
		             
		             if(item==""){
		                $("#addMsgId").html("<span style='color:red;font-size:15px;'>日报项不能为空!</span>");
		                return false;
		             }
		             $.ajax({
						url: "../workReportApp!addWorkReport",
						data: {
						item:encodeURI(encodeURI(item)),
						time:time
					},
					success: function(data) {
						var obj = eval('(' + data + ')');
						if (obj.result == 1) {
			                $.mobile.changePage("ribao.html", {transition: "slide"});
						    //重新刷新页面
						     $('#itemsId').listview('refresh');
						}else if(obj.result==2){
						    $("#addMsgId").html(obj.errorMsg);
						}else if(obj.result==3){
						   $.mobile.changePage("index.html", {transition: "slide"});
						}else{
						   $("#addMsgId").html("<span style='color:red;'>网络连接异常!</span>");
						}
					  }
					});
		        });
		        
		         //2.点击日报项
		        $("#itemId").bind('click',function(){
		               $("#addMsgId").html("");
		        });
		        //3.添加返回
		        $("#addBackId").bind('click',function(){
		             $("#listMsgId").html("");
		        });
	    });
	    </script>
			<div data-role="header" data-position="fixed">
				<a data-rel="back" data-icon="back" id="addBackId">返回</a>
				<h1>
					添加日报
				</h1>
			</div>
			<div data-role="content">
				<div data-role="fieldcontain">
					<label for="item">
						日报项:
					</label>
					<textarea id="itemId"></textarea>
				</div>
				<div data-role="fieldcontain">
					<label for="time">
						时间(小时):
					</label>
					<input type="range" name="slider" id="timeId" value="1" min="1"
						max="8" />
				</div>
				<br />
				<center>
					<div id='addMsgId' style='color: red;'></div>
				</center>
				<a data-role="button" id="addbutId">提交</a>
			</div>
	</body>
</html>
